#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int left = 0;
        for (int right = 1; right < nums.size(); right++)
        {
            if (nums[right] != nums[left])
            {
                nums[left + 1] = nums[right];
                left++;
            }
        }
        return left + 1;
    }
};